﻿Public Class clsMstList

    Public Sub setALLLoc(cmb As Windows.Forms.ComboBox, mstXH As String)
        Dim dt As DataTable
        cmb.Items.Clear()
        dt = getALLLoc(mstXH)
        If dt.Rows.Count > 0 Then
            For i As Integer = 0 To dt.Rows.Count - 1
                cmb.Items.Add(dt.Rows(i)("mst_value"))
            Next
        End If
    End Sub

    Public Function getALLLoc(_wareHouseType As String) As DataTable
        Dim szSql As String = String.Empty
        szSql &= "SELECT * "
        szSql &= "  FROM sf.t_mst_list "
        szSql &= "  WHERE factory_id =? "
        szSql &= "  AND mst_type = ? "
        szSql &= "  AND param1 = ? "
        szSql &= "  AND enabled = true "
        szSql &= "  ORDER BY mst_type,update_time "
        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", "07", _wareHouseType)
        If IsNothing(dt) Then
            getALLLoc = New DataTable
        Else
            getALLLoc = dt
        End If
    End Function

    Public Function getEmptyLoc(_wareHouseType As String) As DataTable
        Dim szSql As String = String.Empty
        szSql &= "SELECT * "
        szSql &= "  FROM sf.t_mst_list "
        szSql &= "  WHERE factory_id =? "
        szSql &= "  AND mst_type = ? "
        szSql &= "  AND param1 = ? "
        szSql &= "  AND param2 = ? "
        szSql &= "  AND enabled = true "

        szSql &= "  ORDER BY mst_type,update_time "

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", "07", _wareHouseType, "0")
        If IsNothing(dt) Then
            getEmptyLoc = New DataTable
        Else
            getEmptyLoc = dt
        End If
    End Function
End Class
